﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using FeatureModelCore;
using FeatureModelCore.FMInterface;

namespace FeatureModelTool.InformationBox
{
    /// <summary>
    /// Interaction logic for PropertyTab.xaml
    /// </summary>
    public partial class PropertyTab : TabItem
    {
        public PropertyTab()
        {
            InitializeComponent();
        }

        public void Bind(IFeature node)
        {
            this.Header = string.Format("{0}'s Property.", node.FeatureName);
            this.propertyDataGrid.ItemsSource = node.Properties;
        }

        
        public void TabItem_SizeChanged()
        {
            TabControl tabControl = this.Parent as TabControl;
            if (tabControl == null)
            {
                return;
            }
            double width = tabControl.ActualWidth - 10;
            this.propertyDataGrid.Width = width;
            DataGridTextColumn column = (DataGridTextColumn)this.propertyDataGrid.Columns[1];
            column.Width = width - 120;
        }
    }
}
